import Vue from 'vue'

import 'normalize.css/normalize.css' // css初始化

import ElementUI from 'element-ui' // elementui包
import 'element-ui/lib/theme-chalk/index.css' // elementui样式文件
// import locale from 'element-ui/lib/locale/lang/en' // elementui的英文包

import '@/styles/index.scss' // 全局的样式文件

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // 导入字体图标svg
import '@/permission' // 路由导航守卫(登录拦截)
// console.log(process.env) // 获取处于哪种开发环境的
/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
// if (process.env.NODE_ENV === 'production') {
//   const { mockXHR } = require('../mock')
//   mockXHR()
// }

// 注册英文版本的elementui
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)

Vue.config.productionTip = false

Vue.directive('check', {
  inserted(el, binding) {
    console.log(el) // 使用指令的dom元素
    // console.log(binding) // binding是一个对象 , 对象记录指令的信息 binding.value是指令的值
    if (!store.getters?.points.includes(binding.value)) {
      el.style.display = 'none'
    } else {
      el.style.display = 'block'
    }
  }
})
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
